// 模拟施工方案数据
export const mockConstructionSchemes = [
  {
    id: 'scheme-1',
    name: '500kV输电线路跨越施工方案',
    version: '1.0',
    approvalStatus: 'draft',
    crossingPointId: 'crossing-1',
    constructionMethod: '张力放线法',
    methodReasoning: '适用于大跨越距离施工，安全性高',
    constructionStartDate: '2023-11-01',
    constructionEndDate: '2023-11-15',
    totalDuration: 15,
    costEstimation: 500000,
    constructionSteps: [
      {
        id: 'step-1',
        stepOrder: 1,
        stepName: '施工准备',
        description: '材料与设备进场检验',
        durationHours: 24
      }
    ],
    // 其他必要字段...
  }
];

// 模拟接口方法
export const ConstructionSchemeMock = {
  get: async (id) => {
    // 模拟网络延迟
    await new Promise(resolve => setTimeout(resolve, 500));
    
    const scheme = mockConstructionSchemes.find(item => item.id === id);
    if (!scheme) {
      throw new Error('未找到指定的施工方案');
    }
    return scheme;
  },
  update: async (id, data) => {
    await new Promise(resolve => setTimeout(resolve, 500));
    const index = mockConstructionSchemes.findIndex(item => item.id === id);
    if (index === -1) {
      throw new Error('更新失败，未找到方案');
    }
    mockConstructionSchemes[index] = { ...mockConstructionSchemes[index], ...data };
    return mockConstructionSchemes[index];
  },
  list: async () => {
    await new Promise(resolve => setTimeout(resolve, 500));
    return mockConstructionSchemes;
  }
};